package com.example.flutter_demo2.aty

import android.os.Bundle
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import com.example.flutter_demo2.R
import io.flutter.embedding.android.FlutterActivity

class NativeActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_native)

        findViewById<Button>(R.id.btn_open_flutter_page_by_multi_engine).setOnClickListener {
            startActivity(
                FlutterActivity
                    // cache and pre warm in actual, and register channel
                    .withNewEngine()
                    .build(this)
            )
        }

        findViewById<Button>(R.id.btn_open_flutter_page_by_single_engine).setOnClickListener {
            HostActivity.actionStart(this)
        }
    }
}